Problem getting OLE pasted into richText box into the Object Text

For some reason I am unable to paste an OLE into a RichText box and then get the richText and store it into the object text. I am using DOORS 8.3. The relevant code is:
 

string sObjectText
 
sObjectText = get(dbeNonRequirementText)
o."Object Text" = richText(sObjectText)


where o is the current object and dbeNonRequirementText is defined as a richText box. The result in the Object Text shows rtf artifacts instead of the OLE. It is as if the richText function didn't do anything. Am I doing something wrong? I've tried different combinations of richTextFragment, and even exportRTFString to no avail. It seems like it should be straightforward, but it doesn't seem to work.

-David Bond


David_G_Bond - Thu May 20 17:25:43 EDT 2010

Re: Problem getting OLE pasted into richText box into the Object Text
a_vestlin - Fri May 21 02:58:18 EDT 2010

Hi

This is an example which uses the set and get functions.
 

DBE rt
DB db = create("test")
void procCopy(DB win)
{
    Object o = current
        if ( !null(o) )
        {
                set(rt, o."Object Text")
        }
}
 
void procPaste(DB win)
{
        Object o = current
        if ( !(null(o)) )
        {
                get(rt, o."Object Text")
        } 
}
 
rt = richText(db, "Test of object update", "", 300, 250, false)
apply(db, "Copy", procCopy)
apply(db, "Paste", procPaste)
show(db)

 


/Anders

 

Re: Problem getting OLE pasted into richText box into the Object Text
Peter_Albert - Fri May 21 02:58:52 EDT 2010

Hmm, this should work. I scribbled together a complete script as follows:

DB baseDB 
DBE richTextDBE
void pasteIntoObjectText(DB db)
{
  string s = get(richTextDBE)
  Object o = current Object
  o."Object Text" = richText s
  refresh current Module
}
baseDB = create "Paste into Object Text"
richTextDBE = richText(baseDB, "", "", 400, 200, false)
apply(baseDB, pasteIntoObjectText)
show baseDB

and it does paste OLE objects into the Object Text. Maybe you can post your complete code, or at least a working script which fails to paste the OLE objects?

Regards,

Peter

Re: Problem getting OLE pasted into richText box into the Object Text
David_G_Bond - Fri May 21 10:38:21 EDT 2010

Peter_Albert - Fri May 21 02:58:52 EDT 2010

Hmm, this should work. I scribbled together a complete script as follows:

DB baseDB 
DBE richTextDBE
void pasteIntoObjectText(DB db)
{
  string s = get(richTextDBE)
  Object o = current Object
  o."Object Text" = richText s
  refresh current Module
}
baseDB = create "Paste into Object Text"
richTextDBE = richText(baseDB, "", "", 400, 200, false)
apply(baseDB, pasteIntoObjectText)
show baseDB

and it does paste OLE objects into the Object Text. Maybe you can post your complete code, or at least a working script which fails to paste the OLE objects?

Regards,

Peter

Unfortunately, the script is thousands of lines long and most of it is proprietary. I can write a short script, but when I do, the transfer of data from the richText box to the Object Text works fine. It is only in the context of the larger, complex script that it fails. I have even halted the script immediately after the line that assigns the Object Text to make sure I am not doing something afterward to cause problems. The only thing I can think of is that something is occurring to change the characteristics of the richText box or the Object Text. The OLE shows up fine in the richText box. If I use the a simple script with the same OLE it works fine. I've even tried using buffers to see if that makes a difference. I don't know if it is something I have done or if it is a bug in DOORS. Any thoughts on what could cause this problem would be greatly appreciated.

  • David Bond

Re: Problem getting OLE pasted into richText box into the Object Text
llandale - Fri May 21 10:54:44 EDT 2010

a_vestlin - Fri May 21 02:58:18 EDT 2010

Hi

This is an example which uses the set and get functions.
 

DBE rt
DB db = create("test")
void procCopy(DB win)
{
    Object o = current
        if ( !null(o) )
        {
                set(rt, o."Object Text")
        }
}
 
void procPaste(DB win)
{
        Object o = current
        if ( !(null(o)) )
        {
                get(rt, o."Object Text")
        } 
}
 
rt = richText(db, "Test of object update", "", 300, 250, false)
apply(db, "Copy", procCopy)
apply(db, "Paste", procPaste)
show(db)

 


/Anders

 

Fixed. This works. Notice the richTextWithOle, assigning from get, and refresh module.

DBE rt
DB db = create("test")
Module mod = current
void procCopy(DB win)
{
    Object o = current
        if ( !null(o) )
        {
                set(rt, richTextWithOle(o."Object Text"))
        }
}
 
void procPaste(DB win)
{
        Object o = current
        if ( !(null(o)) )
        {
                o."Object Text" = richText(get(rt))
                refresh(mod)
        } 
}
 
rt = richText(db, "Test of object update", "", 300, 250, false)
apply(db, "Copy", procCopy)
apply(db, "Paste", procPaste)
show(db)

 

  • Louie

 

Re: Problem getting OLE pasted into richText box into the Object Text
llandale - Fri May 21 11:07:58 EDT 2010

David_G_Bond - Fri May 21 10:38:21 EDT 2010
Unfortunately, the script is thousands of lines long and most of it is proprietary. I can write a short script, but when I do, the transfer of data from the richText box to the Object Text works fine. It is only in the context of the larger, complex script that it fails. I have even halted the script immediately after the line that assigns the Object Text to make sure I am not doing something afterward to cause problems. The only thing I can think of is that something is occurring to change the characteristics of the richText box or the Object Text. The OLE shows up fine in the richText box. If I use the a simple script with the same OLE it works fine. I've even tried using buffers to see if that makes a difference. I don't know if it is something I have done or if it is a bug in DOORS. Any thoughts on what could cause this problem would be greatly appreciated.

  • David Bond

Well, that post should have been your first post.

I've never run into a situation where a large script effectively corrupts itself due to its size; and I've got some whopping scripts. Thus, there is something wrong with your script.

If this were me, I'd do these things: [1] Turn on OLE in History (database parameter), run the script, then check Object Text History. [2] Look for corruption of your richText DBE variable. Perhaps DBE rtTemp = MyRichTextBox right after you define MyRichTextBox = richText(...), then check it again after your assignment statement. [3] Be sure you are actually assigning to the right Object; assigning to the 'current' Object is potentical disaster. Dump the Identifier of the object getting its Text updated. [3] Be sure to refresh(module(obj)); MAYBE you are just not seeing the update.

  • Louie

Re: Problem getting OLE pasted into richText box into the Object Text
Mathias Mamsch - Fri May 21 14:20:46 EDT 2010

David_G_Bond - Fri May 21 10:38:21 EDT 2010
Unfortunately, the script is thousands of lines long and most of it is proprietary. I can write a short script, but when I do, the transfer of data from the richText box to the Object Text works fine. It is only in the context of the larger, complex script that it fails. I have even halted the script immediately after the line that assigns the Object Text to make sure I am not doing something afterward to cause problems. The only thing I can think of is that something is occurring to change the characteristics of the richText box or the Object Text. The OLE shows up fine in the richText box. If I use the a simple script with the same OLE it works fine. I've even tried using buffers to see if that makes a difference. I don't know if it is something I have done or if it is a bug in DOORS. Any thoughts on what could cause this problem would be greatly appreciated.

  • David Bond

Maybe you post your script, or send it by email - that might be the quickest way to find out. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Problem getting OLE pasted into richText box into the Object Text
David_G_Bond - Thu May 27 11:47:40 EDT 2010

Mathias Mamsch - Fri May 21 14:20:46 EDT 2010
Maybe you post your script, or send it by email - that might be the quickest way to find out. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Apparently DOORS had gotten into a mode that prevented this from working. I had closed down doors and started it up again without fixing the problem, but magically the next day the problem went away. Apparently I had to restart my computer. Anyway, thanks for your responses. Next time I run into a problem like this I'll not stop with restarting DOORS but try restarting my computer.

  • David Bond